#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
class Base
{
public:
	Base()
	{
		std::cout << __func__ << ":" << __LINE__ << std::endl;
	}
	Base(int i)
	{
		std::cout << __func__ << ":" << __LINE__ << std::endl;
	}
};
template<typename T>
class Deleter
{
public:
	void operator()(T* t)
	{
		std::cout << "deleter called" << std::endl;
		delete t;
	}
};
template<typename T, typename... Args>
boost::shared_ptr<T> MAKE(const std::string& func, int line, Args&&... args)
{
	std::cout << func << ":" << line << std::endl;
	boost::shared_ptr<T> pt(static_cast<T*>(0), boost::detail::sp_ms_deleter<T>());
	boost::detail::sp_ms_deleter<T>* pd = boost::get_deleter<boost::detail::sp_ms_deleter<T> >(pt);
	void* pv = pd->address();
	::new(pv) T(boost::detail::sp_forward<Args>(args)...);
	pd->set_initialized();
	T* pt2 = static_cast<T*>(pv);
	boost::detail::sp_enable_shared_from_this(&pt, pt2, pt2);
	return boost::shared_ptr<T>(pt, pt2);
}
#define make(T)\
	MAKE<T>(__func__, __LINE__)
#define make1(T, a0)\
	MAKE<T>(__func__, __LINE__, a0)
int main(int argc, char **argv)
{
	boost::shared_ptr<Base> b = make1(Base, 1);
	return 0;
}
